package org.budo.mongo.wrapper;

import java.util.List;

import org.bson.Document;
import org.bson.codecs.configuration.CodecRegistry;
import org.bson.conversions.Bson;
import org.budo.mongo.filter.MongoFilter;
import org.budo.mongo.filter.MongoFilterChain;
import org.budo.mongo.filter.MongoFilterChainImpl;

import com.mongodb.ReadConcern;
import com.mongodb.ReadPreference;
import com.mongodb.WriteConcern;
import com.mongodb.client.ListCollectionsIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.MongoIterable;
import com.mongodb.client.model.CreateCollectionOptions;
import com.mongodb.client.model.CreateViewOptions;

public class MongoDatabaseWrapper implements MongoDatabase {
    private MongoFilterChain filterChain;

    private MongoDatabase mongoDatabase;

    public MongoDatabaseWrapper(List<MongoFilter> filters, MongoDatabase mongoDatabase) {
        this.filterChain = new MongoFilterChainImpl(filters);
        this.mongoDatabase = mongoDatabase;
    }

    @Override
    public void createCollection(String $0) {
        filterChain.mongoDatabase_createCollection(this.mongoDatabase, $0);
    }

    @Override
    public void createCollection(String $0, CreateCollectionOptions $1) {
        filterChain.mongoDatabase_createCollection(this.mongoDatabase, $0, $1);
    }

    @Override
    public void createView(String $0, String $1, List $2) {
        filterChain.mongoDatabase_createView(this.mongoDatabase, $0, $1, $2);
    }

    @Override
    public void createView(String $0, String $1, List $2, CreateViewOptions $3) {
        filterChain.mongoDatabase_createView(this.mongoDatabase, $0, $1, $2, $3);
    }

    @Override
    public void drop() {
        filterChain.mongoDatabase_drop(this.mongoDatabase);
    }

    @Override
    public CodecRegistry getCodecRegistry() {
        return filterChain.mongoDatabase_getCodecRegistry(this.mongoDatabase);
    }

    @Override
    public MongoCollection getCollection(String $0, Class $1) {
        return filterChain.mongoDatabase_getCollection(this.mongoDatabase, $0, $1);
    }

    @Override
    public MongoCollection getCollection(String $0) {
        return filterChain.mongoDatabase_getCollection(this.mongoDatabase, $0);
    }

    @Override
    public String getName() {
        return filterChain.mongoDatabase_getName(this.mongoDatabase);
    }

    @Override
    public ReadConcern getReadConcern() {
        return filterChain.mongoDatabase_getReadConcern(this.mongoDatabase);
    }

    @Override
    public ReadPreference getReadPreference() {
        return filterChain.mongoDatabase_getReadPreference(this.mongoDatabase);
    }

    @Override
    public WriteConcern getWriteConcern() {
        return filterChain.mongoDatabase_getWriteConcern(this.mongoDatabase);
    }

    @Override
    public MongoIterable listCollectionNames() {
        return filterChain.mongoDatabase_listCollectionNames(this.mongoDatabase);
    }

    @Override
    public ListCollectionsIterable listCollections(Class $0) {
        return filterChain.mongoDatabase_listCollections(this.mongoDatabase, $0);
    }

    @Override
    public ListCollectionsIterable listCollections() {
        return filterChain.mongoDatabase_listCollections(this.mongoDatabase);
    }

    @Override
    public Object runCommand(Bson $0, ReadPreference $1, Class $2) {
        return filterChain.mongoDatabase_runCommand(this.mongoDatabase, $0, $1, $2);
    }

    @Override
    public Object runCommand(Bson $0, Class $1) {
        return filterChain.mongoDatabase_runCommand(this.mongoDatabase, $0, $1);
    }

    @Override
    public Document runCommand(Bson $0) {
        return filterChain.mongoDatabase_runCommand(this.mongoDatabase, $0);
    }

    @Override
    public Document runCommand(Bson $0, ReadPreference $1) {
        return filterChain.mongoDatabase_runCommand(this.mongoDatabase, $0, $1);
    }

    @Override
    public MongoDatabase withCodecRegistry(CodecRegistry $0) {
        return filterChain.mongoDatabase_withCodecRegistry(this.mongoDatabase, $0);
    }

    @Override
    public MongoDatabase withReadConcern(ReadConcern $0) {
        return filterChain.mongoDatabase_withReadConcern(this.mongoDatabase, $0);
    }

    @Override
    public MongoDatabase withReadPreference(ReadPreference $0) {
        return filterChain.mongoDatabase_withReadPreference(this.mongoDatabase, $0);
    }

    @Override
    public MongoDatabase withWriteConcern(WriteConcern $0) {
        return filterChain.mongoDatabase_withWriteConcern(this.mongoDatabase, $0);
    }

}